
import java.io.IOException;

import java.util.*;


public class HJ36 {
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        String secret = sc.nextLine();
        String text = sc.nextLine();
        StringBuffer sb = new StringBuffer();
        LinkedHashSet<Character> set = new LinkedHashSet<>();
        for (int i = 0; i < secret.length(); i++) {
            set.add(secret.charAt(i));
        }
        int temp = 0;
        while(set.size()<26){
            set.add((char)('a'+temp));
            temp++;
        }
        List<Character> list = new ArrayList<>(set);
        for (int i = 0; i < text.length(); i++) {
            int index = text.charAt(i) - 'a';
            sb.append(list.get(index));
        }
        System.out.println(sb);
    }
}
